package com.lzy.elasticsearch.service;

import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;
import org.elasticsearch.client.indices.PutMappingRequest;

/**
 * TODO 可以再封装，request对象在实现类里面创建，外面调用只需要传入需要的参数即可
 *
 * @author L
 */
public interface ElasticsearchService {

    boolean existsIndex(GetIndexRequest request);

    void createIndex(CreateIndexRequest request);

    void deleteIndex(DeleteRequest request);

    GetIndexResponse getIndex(GetIndexRequest request);

    void updateIndexAliases(IndicesAliasesRequest request);

    void putIndexMapping(PutMappingRequest request);


    IndexResponse addDoc(IndexRequest request);

    DeleteResponse deleteDoc(DeleteRequest request);

    SearchResponse searchDoc(SearchRequest request);

    SearchResponse scrollDoc(SearchScrollRequest request);

    GetResponse getDoc(GetRequest request);

    UpdateResponse updateDoc(UpdateRequest request);

    BulkResponse bulkOperation(BulkRequest request);
}
